package com.cn.xly2023.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

@RestController
@Api(value = "order数据test",tags = "order数据接口API")
@RequestMapping("/order")
public class OrderController {


    @RequestMapping(value = "/test01", method = RequestMethod.GET)
    @ApiOperation(value = "order test01",notes = "验证用户名密码")
    public Map<String,Object> test01(){

       HashMap<String,Object> hashMap = new HashMap<>();
       hashMap.put("code",200);
       hashMap.put("msg","登陆成功!");
       MyBean mybean = new MyBean();
       mybean.setUsername("frk");
       mybean.setPassword("密码");
       hashMap.put("bean",mybean);

        ArrayList<String> arrayList = new ArrayList();
        arrayList.add("1");
        arrayList.add("2");
        arrayList.add("3");
        arrayList.add("4");

        hashMap.put("arr",arrayList);
       return hashMap;
    }
    @RequestMapping(value = "/test02",method = RequestMethod.POST)
    @ApiOperation(value = "order test02",notes = "看信息")
    public Map<String, Object> test02(String username, String password){

        HashMap<String,Object> hashMap = new HashMap<>();
        hashMap.put("code",200);
        hashMap.put("msg","登陆成功!");
        hashMap.put("username",username);
        hashMap.put("password",password);
        return hashMap;

    }


    class MyBean{

        private String username;
        private String password;

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }
    }
}
